<?php

class User
{
	private static $_IP;
	private static $_session;
	public static function init()
	{
		self::$_IP=$_SERVER["REMOTE_ADDR"];
		session_start();
		SQL::connect("127.0.0.1", "root", "", "hacker");
		mysql_select_db("hacker");
		self::$_session=&$_SESSION;
	}
	public static function getData($key)
	{
		if(!self::issetData($key))
		{
			throw new UserException(sprintf("A megadott kulcs (%s) nem létezik a munkamenetben.", $key));
		}
		return self::$_session[$key];
	}
	public static function setData($key, $value)
	{
		self::$_session[$key]=$value;
	}
	public static function issetData($key)
	{
		return isset(self::$_session[$key]);
	}
	public static function unsetData($key)
	{
		unset(self::$_session[$key]);
	}
}